package com.webtest.dao.admin;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.service.IService;
import com.webtest.entity.Book;
import com.webtest.entity.Shelf;
import com.webtest.vo.SearchBooks;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
@Mapper
public interface AdminShelfMapper extends BaseMapper<Shelf> {

    @Select("select s.*,COUNT(*) num from shelf s join test_book t ON s.shelf_id=t.shelf_id GROUP BY  s.shelf_id")
    public List<Shelf> queryShelf();
    @Select("select s.*,COUNT(*) num from shelf s join test_book t ON s.shelf_id=t.shelf_id where s.shelf_name like CONCAT('%', #{value}, '%')  GROUP BY  s.shelf_id")
    public List<Shelf> queryShelfName(@Param("value") String shelfName);

}
